package org.apache.flink.runtime.rpc.json;

import org.apache.flink.api.common.ConsumerID;

import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;

import java.io.IOException;

/** Json serializer for {@link ConsumerID}. */
public class JobIDSerializer extends StdSerializer<ConsumerID> {

    private static final long serialVersionUID = -6598593519161574611L;

    protected JobIDSerializer() {
        super(ConsumerID.class);
    }

    @Override
    public void serialize(ConsumerID value, JsonGenerator gen, SerializerProvider provider)
            throws IOException {
        gen.writeString(value.toString());
    }
}
